<template>
    <div class="container">
        <banner :sightName="sightName"
                :galleryImgs="galleryImgs"
                :bannerImg="bannerImg"
        ></banner>
        <detail-info></detail-info>
        <detail-header></detail-header>
        <detail-list :list="list"></detail-list>
        <div class="content"></div>
    </div>
</template>

<script>
import banner from './components/banner'
import DetailHeader from './components/header'
import DetailList from './components/list'
import DetailInfo from './components/detail-info'
import axios from 'axios'
export default {
  name: 'Detail',
  data () {
    return {
      sightName: '',
      galleryImgs: [],
      list: [],
      bannerImg: ''
    }
  },
  components: {
    DetailInfo,
    banner,
    DetailHeader,
    DetailList
  },
  mounted () {
    this.getDetailInfo()
  },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      }).then(this.handleGetDataSucc)
    },
    handleGetDataSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        console.log(res.data)
        this.sightName = res.data.sightName
        this.galleryImgs = res.data.gallaryImgs
        this.list = res.data.categoryList
        this.bannerImg = res.data.bannerImg
      }
    }
  }
}
</script>

<style scoped lang="stylus">
    .container
        background: #cccccc
        .content
            height:8rem
            background-color: #fff
</style>
